<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <label for="">
      <input type="checkbox" class="d1" value="足球" />
      足球
    </label>
    <label for="">
      <input type="checkbox" class="d2" value="篮球" checked />
      篮球
    </label>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script>
      $(() => {
        console.log('1-空', $('.d1').attr('checked')) // undefined
        console.log('1-c', $('.d2').attr('checked')) // 'checked' （字符串）
      })
    </script>
  </body>
</html>
